Change two lines in this algorithm so as to compute the internal energy and the specific heat (see SMAC p. 235).
Check the implementation of this algorithm in the 6x6 lattice with periodic boundary conditions (compare with SMAC Table 5.3 page 236, which was obtained using exact enumerations): compare (on a graphic) your numerical evaluations of the internal energy and the specific heat to that provided in the table. Comment on the convergence in time. For a some well-chosen (i.e. far and around Tc) temperatures, determine the error of your evaluation using the bunching algorithm, and comment.
B- Cluster algorithm
Implement the Wolff cluster algorithm as seen during the lecture:
L=32
N=L*L
S=[choice([-1,1])for k inrange(N)]
beta=
p=1 - exp(-2*beta)
nbr,site_dic,x_y_dic=square_neighbors(L)foriterinrange(100):
k=randint(0,N-1)
Pocket =[k]
Cluster =[k]
N_cluster =1while Pocket !=[]:
k =choice(Pocket)for l in nbr[k]:
if S[l]== S[k]and l notin Cluster and ran(0,1)< p:
N_cluster +=1
Pocket.append(l)
Cluster.append(l)
Pocket.remove(k)for k in Cluster: S[k]= - S[k]printiter, N_cluster
For large lattices, such as 32x32, determine numerically the mean cluster size flipped at each step of this algorithm as a function of temperature. Comment. (Bonus: explain the observed behaviour).
C- Comparison between local and cluster algorithm
Consider as an observable the mean value of the absolute magnetization
Using the bunching algorithm, determine the error on the measure of this observable for the two algorithms at the inverse temperatures given above (try 14 bunching iterations for β = 0.2 and 16 for β = 0.4).
Table of Contents
Introduction
In this exercise, we study the local Metropolis algorithm and the Cluster algorithm for the two-dimensional Ising model.A- Local algorithm
Implement the local Metropolis algorithm, as seen during the lecture:B- Cluster algorithm
Implement the Wolff cluster algorithm as seen during the lecture:
C- Comparison between local and cluster algorithm
Consider as an observable the mean value of the absolute magnetization[Print this page]